package com.sesame.providerdemo.service.impl;

import com.sesame.providerdemo.service.IFileService;
import org.apache.commons.io.FileUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.io.File;
import java.util.List;

@Service
public class FileServiceImpl implements IFileService {

    private static final String FILE_DIR = "D:\\work\\newProject\\process_20190123143426.log";

    @Override
    @Async
    public List<String> getFileData() {

        try {
            File file = new File(FILE_DIR);
            List<String> lines = FileUtils.readLines(file, "UTF-8");
            return lines;
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
